	package com.bid.base.common.responseV2;

	import lombok.Getter;

    @Getter
    public enum ErrorCode {
        /**
         * 成功
         */
        SUCCESS(20,"成功"),

        /**
         * token刷新
         */
        TOKEN_REFRESH(25,"token刷新"),
        /**
         * 登录超时
         */
        NO_LOGIN_TIME_OUT(10,"登录超时"),
        /**
         * 服务端错误
         */
        ERROR(50,"服务端错误,请根据url联系各自微服务联系人"),
        /**
         * 无权限操作
         */
        NO_RIGHT(30,"无权限操作"),
        RIGHT_OVERRIDE(31,"当前登录被踢出"),
        AUTH_STATUS_CHANGED(32,"权限变化重新登录"),
        /**
         * 参数错误
         */
        PARAM_ERROR(40,"参数错误"),
        REPEAT_ERROR(41,"操作频繁，请稍等"),
        /**
         * 查询对象不存在
         */
        OBJECT_NOT_EXISTS(80,"查询对象不存在"),
        ;

        private ErrorCode(int status,String msg) {
            this.status = status;
            this.msg = msg;
        }

        private int status;
        private String msg;

        public static ErrorCode of(int status) {
            for (ErrorCode em : ErrorCode.values()) {
                if (em.getStatus() == status){
                    return em;
                }
            }
            return null;
        }
    }
